<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('departments', function (Blueprint $table) {
            $table->id();
            $table->string('name')->default('')->comment('部门名称');
            $table->integer('level')->default(1)->comment('等级');
            $table->string('pid')->default('')->comment('父级集合');
            $table->tinyInteger('status')->default(1)->comment('1启用2禁用');
            $table->integer('shift_id')->nullable()->comment('班次id');
            $table->timestamps();
        });

        \DB::statement("ALTER TABLE `departments` comment '部门设置表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('departments');
    }
};
